hackerrank sparse array problem

visit shbcf.ru